package com.example.shushiyunsst.widget.verification.view;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.EditText;

import com.example.shushiyunsst.R;

/**
 * Created by zhoulikai on 17/4/24.
 * 当前页面显示
 */

public class CurrentPageImageVerificationView extends ImageVerificationView implements TextWatcher {
    private static final String TAG = "CurrentPage";
    private EditText checkEt;
    private CharSequence temp;

    public CurrentPageImageVerificationView(Context context) {
        super(context);
    }

    @Override
    protected int setVerificationViewId() {
        return R.layout.current_image_verification_layout;
    }

    @Override
    protected void initView(Context context, AttributeSet attrs) {
        super.initView(context, attrs);
        checkEt = (EditText) this.findViewById(R.id.check_et);
        checkEt.addTextChangedListener(this);
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        temp = s;
    }

    @Override
    public void afterTextChanged(Editable s) {
        Log.d(TAG, ">>>>>>>beforeTextChanged>>>>>>>>>>");
//        if (!TextUtils.isEmpty(temp) && temp.length() == 4) {
            verification();
//        }
    }

}